<template>
	<view class="cencon">
		<view class="tou"></view>
			<view class="row" v-for="(row,index) in couponValidList" :key="index"  @click="checkcompany(row)">
				<view class="one">
					<view class="title">
						{{row.name}}
					</view>
					<view class="term">
						股权单价{{row.price}}
					</view>
				</view>
			</view>
		
	</view>
</template>

<script>
	export default {
		data() {
			return {
				couponValidList: [],

			}
		},
		onLoad() {
			// 公司列表
			uni.request({
				url: 'http://tuiguang.yiyunoto.com/api/member/exchangeoption',
				header: { authtoken: this.$store.state.token },
				success: res => {
					console.log('11请求成功', res);
					this.couponValidList = res.data.data.compony;
				},
				fail: res => {
					console.log('请求失败', res);
				}
			});
			
			//兼容H5下排序栏位置
			// #ifdef H5
			//定时器方式循环获取高度为止，这么写的原因是onLoad中head未必已经渲染出来。
			let Timer = setInterval(() => {
				let uniHead = document.getElementsByTagName('uni-page-head');
				if (uniHead.length > 0) {
					this.headerTop = uniHead[0].offsetHeight + 'px';
					clearInterval(Timer); //清除定时器
				}
			}, 1);
			// #endif
		},
		methods: {
			// 返回数据至上一页
			checkcompany:function(item){
					//this.$api.prePage()获取上一页实例，在App.vue定义
					this.$api.prePage().option = item;
					uni.navigateBack()
				
			},
		}
	}
</script>

<style>
	.cencon {
		width: 100%;
		background: #FFFFFF;
	}
	.tou{
		border: 0.5upx #E6E6E6 solid;
	}
	.one {
		float: left;
	}
	.row {
		width: 100%;
		height: 143upx;
		background: #FFFFFF;
		margin-top: 2upx;
		border-bottom-width: 1upx;
		border-bottom-style: solid;
		border-bottom-color: #EDEDED;
	}
	.title {
		font-size: 32upx;
		font-family: PingFangSC-Regular, PingFangSC;
		color: rgba(41, 41, 41, 1);
		padding-left: 30upx;
		padding-top: 30upx;
	}
	.term {
		font-size: 26upx;
		font-family: PingFangSC-Regular, PingFangSC;
		color: rgba(127, 127, 127, 1);
		padding-left: 30upx;
		padding-top: 1upx;
	}
</style>
